package sample.test{
	import com.takanafu.haruframework.aopalliance.reflect.Method;
	import com.takanafu.haruframework.aop.ThrowsAdvice;
	import mx.collections.ArrayCollection;
	import com.takanafu.haruframework.d2l.invoker.MethodInfo;
	import mx.controls.Alert;
	import com.takanafu.haruframework.d2l.util.ApplicationContext;

	public class ExceptionHandler implements ThrowsAdvice{
		private var cm:ConsoleManager;
		
		function ExceptionHandler(){
			cm = ApplicationContext.getBean("consoleManager") as ConsoleManager;
		}
		
		public function afterThrowing(m:Method,args:ArrayCollection,target:Object,ex:Error):MethodInfo{
			cm.println("[ExceptionHandler]"+ex.message);
			Alert.show(ex.getStackTrace(),ex.message);
			
			return null;
		}
		
	}
}